﻿using System;

namespace UdpAuthorizationService.Core.Logging
{
	public class ConsoleLogger : LoggingFacade
	{
		public override void Log(LogEvent logEvent)
		{
			ConsoleColor color;
			switch (logEvent.Severity)
			{
				case Severity.Debug:
					color = ConsoleColor.Cyan;
					break;
				case Severity.Info:
					color = ConsoleColor.Green;
					break;
				case Severity.Warn:
					color = ConsoleColor.Yellow;
					break;
				case Severity.Error:
					color = ConsoleColor.Red;
					break;
				default:
					color = ConsoleColor.White;
					break;
			}

			Console.ForegroundColor = color;
			Console.WriteLine("{0:HH:mm:ss}\t{1}\t{2}", logEvent.Time, logEvent.Severity, logEvent.Message);
			Console.ResetColor();
		}
	}
}
